//
//  Test22.cpp
//  CPPTest
//
//  Created by you5 Yi on 2021/9/25.
//

#include "Test22.hpp"
#include <iostream>
using namespace std;

void test22()
{
    void sort2(int s[]);
    int score[5];
    int i;
    for (i=0; i<5; i++) {
        score[i] = i;
    }
    sort2(score);
    cout<<"运算结果是:";
    for (i=0; i<5; i++) {
        cout<<score[i]<<" ";
    }
}
void sort2(int s[])
{
    // 0 1 2 3 4
    int t;
    for (int i=0; i<4; i++) {
        for (int j=i+1; j<5; j++) {
            if (s[i]<s[j]) {
                t=s[i];
                s[i]=s[j];
                s[j]=t;
                
                cout<<"运算过程是:";
                for (int k=0; k<5; k++) {
                    cout<<s[k]<<" ";
                }
                cout<<endl;
            }
        }
    }
}
